home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMMLIB.MAC < prev    next >
Text File  |  1989-11-29  |  27KB  |  475 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;       Macro Name:   MULT         arg, val                                   ;
  3. ;           Author:   W J Krueger                                             ;
  4. ;             Date:   5/12/87                                                 ;
  5. ;      Description:   If val is 0 or a power of two this macro multiplies     ;
  6. ;                     arg by val.                                             ;
  7. ;-----------------------------------------------------------------------------;
  8. MULT    MACRO    arg, val
  9.     bit_pat = (val)
  10.     bit_cnt = ((val) AND 1)
  11.     IF     ((bit_pat) EQ 0)
  12.           MOV        arg, 0
  13.      ELSEIF ((bit_pat) NE 1)
  14.       REPT 15
  15.         IF ((bit_cnt) EQ 0)
  16.           SHL        arg, 1
  17.         ENDIF
  18.         bit_pat = (bit_pat) SHR 1
  19.         IF ((bit_pat) AND 1)
  20.           bit_cnt = (bit_cnt) + 1
  21.         ENDIF
  22.       ENDM
  23.     ENDIF
  24.     IF ((bit_cnt) GT 1)
  25.       IF2
  26.         .ERR The MULT macro cannot multiply &arg by &val.  Use a MUL instruction.
  27.         %OUT The MULT macro cannot multiply &arg by &val.  Use a MUL instruction.
  28.       ENDIF
  29.     ENDIF
  30. ENDM
  31.  
  32. PAGE
  33. ;----------------------GENERIC MOVE INSTRUCTION PARSER------------------------;
  34. ;                                                                             ;
  35. ;   This macro decomposes the destination and source arguments into "left"    ;
  36. ;   and "right" components for each argument.  The "left" and "right"         ;
  37. ;   argument halves of the destination and source arguments are the text      ;
  38. ;   strings that appear to the left or the right of a colon (:).  So,         ;
  39. ;   a destination or source argument that was formatted as AX:BX would        ;
  40. ;   be separated into left and right components which were equal to AX        ;
  41. ;   and BX respectively.  The example used registers but any text string      ;
  42. ;   (or strings) can be substituted.  For example: ES:word_array[4*3] is      ;
  43. ;   a perfectly acceptable construct.  However, if you want to redefine       ;
  44. ;   the type of one of the arguments (i.e. reference the word_array as a byte ;
  45. ;   array), then you could use ES:<BYTE PTR word_array[12]>.  The point being ;
  46. ;   that this is a macro and requires text separated by spaces to be included ;
  47. ;   inside <> so that the text is considered as a single string.              ;
  48. ;                                                                             ;
  49. ;------------------------------VALID TOKENS-----------------------------------;
  50. ;                                                                             ;
  51. ;   N...nul...null     argument             D...dat...data     argument       ;
  52. ;   S...seg...segment  argument             R...reg...register argument       ;
  53. ;   O...off...offset   argument             C...con...constant argument       ;
  54. ;   A...adr...address  argument             P...con_dat...constant assoc      ;
  55. ;                                                         with data (pointer) ;
  56. ;                                                                             ;
  57. ;-----------------------INVALID TOKEN COMBINATIONS----------------------------;
  58. ;                                                                             ;
  59. ;   nul:adr   seg:con   off:adr   adr:adr   dat:adr   reg:adr   con:adr       ;
  60. ;   nul:con   seg:seg   off:con   adr:con   dat:con   reg:con   con:dat       ;
  61. ;   nul:dat             off:dat   adr:dat   dat:dat   reg:dat   con:off       ;
  62. ;   nul:nul             off:off   adr:off   dat:off   reg:off   con:reg       ;
  63. ;   nul:off             off:reg   adr:reg   dat:reg   reg:seg   con:seg       ;
  64. ;   nul:reg             off:seg   adr:seg   dat:seg                           ;
  65. ;   nul:seg                                                                   ;
  66. ;------------------------VALID TOKEN COMBINATIONS-----------------------------;
  67. ;                                                                             ;
  68. ;   seg:adr   off:nul   adr:nul   dat:nul   reg:nul   con:con                 ;
  69. ;   seg:dat                                 reg:reg   con:nul                 ;
  70. ;   seg:nul                                                                   ;
  71. ;   seg:off                                                                   ;
  72. ;   seg:reg                                                                   ;
  73. ;                                                                             ;
  74. ;--------------------INVALID TOKEN COMBINATIONS & PAIRINGS--------------------;
  75. ;                                                                             ;
  76. ;   seg:nul, con:con   reg:nul, con:con   con:con, adr:nul                    ;
  77. ;   seg:nul, reg:reg   reg:nul, reg:reg   con:con, con:con                    ;
  78. ;   seg:nul, seg:reg   reg:nul, seg:reg   con:con, con:nul                    ;
  79. ;   seg:reg, con:nul   reg:reg, con:nul   con:con, dat:nul                    ;
  80. ;   seg:reg, reg:nul   reg:reg, reg:nul   con:con, off:nul                    ;
  81. ;   seg:reg, seg:nul   reg:reg, seg:nul   con:con, reg:nul                    ;
  82. ;                                         con:con, reg:reg                    ;
  83. ;                                         con:con, seg:adr                    ;
  84. ;                                         con:con, seg:dat                    ;
  85. ;                                         con:con, seg:nul                    ;
  86. ;                                         con:con, seg:off                    ;
  87. ;                                         con:con, seg:reg                    ;
  88. ;                                         con:nul, adr:nul                    ;
  89. ;                                         con:nul, con:con                    ;
  90. ;                                         con:nul, con:nul                    ;
  91. ;                                         con:nul, dat:nul                    ;
  92. ;                                         con:nul, off:nul                    ;
  93. ;                                         con:nul, reg:nul                    ;
  94. ;                                         con:nul, reg:reg                    ;
  95. ;                                         con:nul, seg:adr                    ;
  96. ;                                         con:nul, seg:dat                    ;
  97. ;                                         con:nul, seg:nul                    ;
  98. ;                                         con:nul, seg:off                    ;
  99. ;                                         con:nul, seg:reg                    ;
  100. ;                                                                             ;
  101. ;-----------------AMBIGUOUS TOKEN COMBINATIONS & PAIRINGS---------------------;
  102. ;                        (due to ambiguous size)                              ;
  103. ;                                                                             ;
  104. ;   seg:adr, adr:nul   off:nul, adr:nul   adr:nul, adr:nul   dat:nul, adr:nul ;
  105. ;   seg:adr, dat:nul   off:nul, dat:nul   adr:nul, dat:nul   dat:nul, dat:nul ;
  106. ;   seg:adr, off:nul   off:nul, off:nul   adr:nul, off:nul   dat:nul, off:nul ;
  107. ;   seg:adr, seg:adr   off:nul, seg:adr   adr:nul, seg:adr   dat:nul, seg:adr ;
  108. ;   seg:adr, seg:dat   off:nul, seg:dat   adr:nul, seg:dat   dat:nul, seg:dat ;
  109. ;   seg:adr, seg:off   off:nul, seg:off   adr:nul, seg:off   dat:nul, seg:off ;
  110. ;   seg:dat, adr:nul                                                          ;
  111. ;   seg:dat, dat:nul                                                          ;
  112. ;   seg:dat, off:nul                                                          ;
  113. ;   seg:dat, seg:adr                                                          ;
  114. ;   seg:dat, seg:dat                                                          ;
  115. ;   seg:dat, seg:off                                                          ;
  116. ;   seg:off, adr:nul                                                          ;
  117. ;   seg:off, dat:nul                                                          ;
  118. ;   seg:off, off:nul                                                          ;
  119. ;   seg:off, seg:adr                                                          ;
  120. ;   seg:off, seg:dat                                                          ;
  121. ;   seg:off, seg:off                                                          ;
  122. ;                                                                             ;
  123. ;-----------------------VALID TOKEN COMBINATIONS & PAIRINGS-------------------;
  124. ;                                                                             ;
  125. ;   seg:nul, seg:nul   seg:off, seg:nul   seg:adr, seg:nul   seg:dat, seg:nul ;
  126. ;   seg:nul, seg:off   seg:off, seg:reg   seg:adr, seg:reg   seg:dat, seg:reg ;
  127. ;   seg:nul, seg:adr   seg:off, reg:nul   seg:adr, reg:nul   seg:dat, reg:nul ;
  128. ;   seg:nul, seg:dat   seg:off, reg:reg   seg:adr, reg:reg   seg:dat, reg:reg ;
  129. ;   seg:nul, off:nul   seg:off, con:nul   seg:adr, con:nul   seg:dat, con:nul ;
  130. ;   seg:nul, adr:nul   seg:off, con:con   seg:adr, con:con   seg:dat, con:con ;
  131. ;   seg:nul, dat:nul                                                          ;
  132. ;   seg:nul, reg:nul                                                          ;
  133. ;   seg:nul, con:nul                                                          ;
  134. ;                                                                             ;
  135. ;   seg:reg, seg:off   off:nul, seg:nul   adr:nul, seg:nul   dat:nul, seg:nul ;
  136. ;   seg:reg, seg:adr   off:nul, seg:reg   adr:nul, seg:reg   dat:nul, seg:reg ;
  137. ;   seg:reg, seg:dat   off:nul, reg:nul   adr:nul, reg:nul   dat:nul, reg:nul ;
  138. ;   seg:reg, seg:reg   off:nul, reg:reg   adr:nul, reg:reg   dat:nul, reg:reg ;
  139. ;   seg:reg, off:nul   off:nul, con:nul   adr:nul, con:nul   dat:nul, con:nul ;
  140. ;   seg:reg, adr:nul   off:nul, con:con   adr:nul, con:con   dat:nul, con:con ;
  141. ;   seg:reg, dat:nul                                                          ;
  142. ;   seg:reg, reg:reg                                                          ;
  143. ;   seg:reg, con:con                                                          ;
  144. ;                                                                             ;
  145. ;   reg:nul, seg:nul   reg:reg, seg:off                                       ;
  146. ;   reg:nul, seg:off   reg:reg, seg:adr                                       ;
  147. ;   reg:nul, seg:adr   reg:reg, seg:dat                                       ;
  148. ;   reg:nul, seg:dat   reg:reg, seg:reg                                       ;
  149. ;   reg:nul, off:nul   reg:reg, off:nul                                       ;
  150. ;   reg:nul, adr:nul   reg:reg, adr:nul                                       ;
  151. ;   reg:nul, dat:nul   reg:reg, dat:nul                                       ;
  152. ;   reg:nul, reg:nul   reg:reg, reg:reg                                       ;
  153. ;   reg:nul, con:nul   reg:reg, con:con                                       ;
  154. ;                                                                             ;
  155. ;-----------------------------------------------------------------------------;
  156.  
  157. MOVE    MACRO    dest, source
  158.     ;;------------------------------------------------------------------------;
  159.     ;;   destination_source argument type encoding string                     ;
  160.     ;;------------------------------------------------------------------------;
  161.     PASS        =    1
  162.     FAIL        =    0
  163.  
  164.     OFF_ARG        =    20h
  165.     DAT_ARG        =    22h
  166.     CON_ARG        =    24h
  167.     CON_DAT_ARG        =    26h
  168.     ADR_ARG        =    2Ah
  169.     REG_ARG        =    30h
  170.     NUL_ARG        =    (0FFh AND -1)
  171.     SEG_ARG        =    (0FFh AND -2)
  172.  
  173.     ;;------------------------------------------------------------------------;
  174.     ;;   destination_source argument type encoding string                     ;
  175.     ;;------------------------------------------------------------------------;
  176.     dest_source_tokens  EQU <>
  177.     dest_R       EQU <>
  178.     dest_L       EQU <>
  179.     source_R     EQU <>
  180.     source_L     EQU <>
  181.     dest_R_len   = 0
  182.     dest_L_len   = 0
  183.     source_R_len = 0
  184.     source_L_len = 0
  185.  
  186.     ;;------------------------------------------------------------------------;
  187.     ;;   display message                                                      ;
  188.     ;;------------------------------------------------------------------------;
  189.     DISPLAY MACRO _text
  190.       IF2
  191.         %OUT _text
  192.       ENDIF
  193.     ENDM
  194.  
  195.     ;;------------------------------------------------------------------------;
  196.     ;;   get attributes of arguments                                          ;
  197.     ;;------------------------------------------------------------------------;
  198.     COMPONENTS  MACRO   arg, arg_L, arg_L_len, arg_R, arg_R_len
  199.       i INSTR <&arg>, <:>
  200.       arg_R_len = 0
  201.       arg_L_len SIZESTR <&arg>
  202.       IF (i NE 0)
  203.         arg_R_len = arg_L_len-i
  204.         arg_L_len = i-1
  205.       ENDIF
  206.       arg_R SUBSTR <&arg>, i+1, arg_R_len
  207.       arg_L SUBSTR <&arg>,   1, arg_L_len
  208.     ENDM
  209.  
  210.     ;;------------------------------------------------------------------------;
  211.     ;;   strip out text component of an argument                              ;
  212.     ;;------------------------------------------------------------------------;
  213.     STRIP MACRO arg, stripped_arg, string
  214.       i     INSTR   <&arg>, <&string>
  215.       i_len SIZESTR <&string>
  216.       IF (i)
  217.         stripped_arg SUBSTR <&arg>, i+i_len
  218.       ENDIF
  219.     ENDM
  220.  
  221.     ;;------------------------------------------------------------------------;
  222.     ;;   tokenize arg into an arg type & concat the type into a type string   ;
  223.     ;;------------------------------------------------------------------------;
  224.     TOKEN   MACRO   arg, arg_len
  225.       IF (arg_len EQ 0)
  226.             dest_source_tokens CATSTR dest_source_tokens, <N>
  227.       ELSE
  228.         i INSTR <DS ES SS CS >, arg
  229.         IF (i)
  230.             dest_source_tokens CATSTR dest_source_tokens, <S>
  231.         ELSE
  232.           i = .TYPE (arg)
  233.           IF (i EQ reg_arg)
  234.             dest_source_tokens CATSTR dest_source_tokens, <R>
  235.           ELSEIF (i EQ off_arg)
  236.             dest_source_tokens CATSTR dest_source_tokens, <O>
  237.           ELSEIF (i EQ adr_arg)
  238.             dest_source_tokens CATSTR dest_source_tokens, <A>
  239.           ELSEIF (i EQ dat_arg)
  240.             dest_source_tokens CATSTR dest_source_tokens, <D>
  241.           ELSEIF (i EQ con_arg)
  242.             dest_source_tokens CATSTR dest_source_tokens, <C>
  243.           ELSEIF (i EQ con_dat_arg)
  244.             dest_source_tokens CATSTR dest_source_tokens, <P>
  245.           ELSE
  246.             dest_source_tokens CATSTR dest_source_tokens, <?>
  247.           ENDIF
  248.         ENDIF
  249.       ENDIF
  250.     ENDM
  251.  
  252.     ;;------------------------------------------------------------------------;
  253.     ;;   decompose dest & source arguments into left & right components       ;
  254.     ;;------------------------------------------------------------------------;
  255.     COMPONENTS <dest>,   <dest_L>,   <dest_L_len>,   <dest_R>,   <dest_R_len>
  256.     COMPONENTS <source>, <source_L>, <source_L_len>, <source_R>, <source_R_len>
  257.  
  258.     ;;------------------------------------------------------------------------;
  259.     ;;   encode dest & source components into dest & source arg type string   ;
  260.     ;;   n = null argument      o = offset argument   c = constant argument   ;
  261.     ;;   s = segment argument   a = address argument                          ;
  262.     ;;   r = register argument  d = data argument                             ;
  263.     ;;------------------------------------------------------------------------;
  264.     TOKEN   <dest_L>,   <dest_L_len>
  265.     TOKEN   <dest_R>,   <dest_R_len>
  266.     TOKEN   <source_L>, <source_L_len>
  267.     TOKEN   <source_R>, <source_R_len>
  268.  
  269.     ;;------------------------------------------------------------------------;
  270.     ;;   FORMS:                                                               ;
  271.     ;;      seg:nul, seg:nul                                                  ;
  272.     ;;                                                                        ;
  273.     ;;   SATISFIED BY:                                                        ;
  274.     ;;      PUSH   source                                                     ;
  275.     ;;      POP    dest                                                       ;
  276.     ;;------------------------------------------------------------------------;
  277.     i INSTR <SNSN>, dest_source_tokens
  278.     IF (i)
  279.       PUSH    source
  280.       POP    dest
  281.       EXITM
  282.     ENDIF
  283.  
  284.     ;;------------------------------------------------------------------------;
  285.     ;;   FORMS:                                                               ;
  286.     ;;      seg:nul, con:nul                                                  ;
  287.     ;;                                                                        ;
  288.     ;;   SATISFIED BY:                                                        ;
  289.     ;;      PUSH   AX                          PUSH   source   (186/286/386)  ;
  290.     ;;      MOV    AX, source        or        POP    dest                    ;
  291.     ;;      MOV    dest, AX                                                   ;
  292.     ;;      POP    AX                                                         ;
  293.     ;;------------------------------------------------------------------------;
  294.     i INSTR <SNCN>, dest_source_tokens
  295.     IF (i)
  296.       IF (@CPU AND 1110b)
  297.         PUSH    source
  298.         POP     dest
  299.       ELSE
  300.         PUSH    AX  
  301.         MOV    AX, source
  302.         MOV    dest, AX
  303.         POP    AX
  304.       ENDIF
  305.       EXITM
  306.     ENDIF
  307.  
  308.     ;;------------------------------------------------------------------------;
  309.     ;;   FORMS:                                                               ;
  310.     ;;      seg:nul, seg:off   seg:adr, seg:nul   dat:nul, seg:nul            ;
  311.     ;;      seg:nul, seg:adr   seg:adr, reg:nul   dat:nul, reg:nul            ;
  312.     ;;      seg:nul, seg:dat   seg:adr, con:nul   dat:nul, con:nul            ;
  313.     ;;      seg:nul, off:nul   seg:dat, seg:nul                               ;
  314.     ;;      seg:nul, adr:nul   seg:dat, reg:nul   reg:nul, seg:nul            ;
  315.     ;;      seg:nul, dat:nul   seg:dat, con:nul   reg:nul, seg:off            ;
  316.     ;;      seg:nul, reg:nul                      reg:nul, seg:adr            ;
  317.     ;;                         off:nul, seg:nul   reg:nul, seg:dat            ;
  318.     ;;      seg:off, seg:nul   off:nul, reg:nul   reg:nul, off:nul            ;
  319.     ;;      seg:off, reg:nul   off:nul, con:nul   reg:nul, adr:nul            ;
  320.     ;;      seg:off, con:nul                      reg:nul, dat:nul            ;
  321.     ;;                         adr:nul, seg:nul   reg:nul, reg:nul            ;
  322.     ;;                         adr:nul, reg:nul   reg:nul, con:nul            ;
  323.     ;;                         adr:nul, con:nul                               ;
  324.     ;;                                                                        ;
  325.     ;;   SATISFIED BY:                                                        ;
  326.     ;;      MOV    dest, source                                               ;
  327.     ;;------------------------------------------------------------------------;
  328.     i INSTR <SNSO SNSA SNSD SNON SNAN SNDN SNRN SOSN SORN SOCN SASN SARN SACN SDSN SDRN SDCN>,           dest_source_tokens
  329.     j INSTR <ONSN ONRN ONCN ANSN ANRN ANCN DNSN DNRN DNCN RNSN RNSO RNSA RNSD RNON RNAN RNDN RNRN RNCN>, dest_source_tokens
  330.     IF (i+j)
  331.       MOV    dest, source
  332.       EXITM
  333.     ENDIF
  334.  
  335.     ;;------------------------------------------------------------------------;
  336.     ;;   FORMS:                                                               ;
  337.     ;;      seg:reg, reg:reg   reg:reg, seg:reg                               ;
  338.     ;;                         reg:reg, reg:reg                               ;
  339.     ;;                         reg:reg, con:con                               ;
  340.     ;;                         reg:reg, reg:con                               ;
  341.     ;;                         reg:reg, con:reg                               ;
  342.     ;;                                                                        ;
  343.     ;;   SATISFIED BY:                                                        ;
  344.     ;;      MOV    dest_Right, source_Right                                   ;
  345.     ;;      MOV    dest_Left,  source_Left                                    ;
  346.     ;;------------------------------------------------------------------------;
  347.     i INSTR <SRRR RRSR RRRR RRCC RRCR RRRC>, dest_source_tokens
  348.     IF (i)
  349.       i INSTR <RRCC>, dest_source_tokens
  350.       IF (i)
  351.         IFIDN <source_R>, <source_L>
  352.           MOV    dest_R, source_L
  353.           MOV    dest_L, dest_R
  354.           EXITM
  355.         ENDIF
  356.       ENDIF
  357.       MOV    dest_R, source_R
  358.       MOV    dest_L, source_L
  359.       EXITM
  360.     ENDIF
  361.  
  362.     ;;------------------------------------------------------------------------;
  363.     ;;   FORMS:                                                               ;
  364.     ;;      seg:reg, ptr:nul                                                  ;
  365.     ;;                                                                        ;
  366.     ;;   SATISFIED BY:                                                        ;
  367.     ;;      MOV    dest_Right, SEG source                                     ;
  368.     ;;      MOV    dest_Left,  dest_Right                                     ;
  369.     ;;      MOV    dest_Right, OFFSET source                                  ;
  370.     ;;------------------------------------------------------------------------;
  371.     i INSTR <SRPN>, dest_source_tokens
  372.     IF (i)
  373.       STRIP <source>, source_L, <OFFSET >
  374.       MOV    dest_R, SEG source_L
  375.       MOV    dest_L, dest_R
  376.       MOV    dest_R, OFFSET source_L
  377.       EXITM
  378.     ENDIF
  379.  
  380.     ;;------------------------------------------------------------------------;
  381.     ;;   FORMS:                                                               ;
  382.     ;;      seg:reg, seg:reg                                                  ;
  383.     ;;      seg:reg, con:con                                                  ;
  384.     ;;                                                                        ;
  385.     ;;   SATISFIED BY:                                                        ;
  386.     ;;      MOV    dest_Right, source_Left                                    ;
  387.     ;;      MOV    dest_Left,    dest_Right                                   ;
  388.     ;;      MOV    dest_Right, source_Right                                   ;
  389.     ;;------------------------------------------------------------------------;
  390.     i INSTR <SRSR SRCC>, dest_source_tokens
  391.     IF (i)
  392.       i INSTR <SRCC>, dest_source_tokens
  393.       IF (i)
  394.         IFIDN <&source_R>, <&source_L>
  395.           MOV    dest_R, source_L
  396.           MOV    dest_L, dest_R
  397.           EXITM
  398.         ENDIF
  399.       ENDIF
  400.       MOV    dest_R, source_L
  401.       MOV    dest_L, dest_R
  402.       MOV    dest_R, source_R
  403.       EXITM
  404.     ENDIF
  405.  
  406.     ;;------------------------------------------------------------------------;
  407.     ;;   FORMS:                                                               ;
  408.     ;;      seg:off, seg:reg   seg:dat, seg:reg   adr:nul, seg:reg            ;
  409.     ;;      seg:off, reg:reg   seg:dat, reg:reg   adr:nul, reg:reg            ;
  410.     ;;      seg:off, con:con   seg:dat, con:con   adr:nul, con:con            ;
  411.     ;;                                                                        ;
  412.     ;;      seg:adr, seg:reg   off:nul, seg:reg   dat:nul, seg:reg            ;
  413.     ;;      seg:adr, reg:reg   off:nul, reg:reg   dat:nul, reg:reg            ;
  414.     ;;      seg:adr, con:con   off:nul, con:con   dat:nul, con:con            ;
  415.     ;;                                                                        ;
  416.     ;;   SATISFIED BY:                                                        ;
  417.     ;;      MOV    WORD PTR dest [0], source_Left                             ;
  418.     ;;      MOV    WORD PTR dest [2], source_Right                            ;
  419.     ;;------------------------------------------------------------------------;
  420.     i INSTR <SOSR SORR SOCC SASR SARR SACC SDSR SDRR SDCC ONSR ONRR ONCC ANSR ANRR ANCC DNSR DNRR DNCC>, dest_source_tokens
  421.     IF (i)
  422.       MOV    WORD PTR dest [0], source_R
  423.       MOV    WORD PTR dest [2], source_L
  424.       EXITM
  425.     ENDIF
  426.  
  427.     ;;------------------------------------------------------------------------;
  428.     ;;   FORMS:                                                               ;
  429.     ;;      seg:reg, seg:off   reg:reg, seg:off   reg:reg, off:nul            ;
  430.     ;;      seg:reg, seg:adr   reg:reg, seg:adr   reg:reg, adr:nul            ;
  431.     ;;      seg:reg, seg:dat   reg:reg, seg:dat   reg:reg, dat:nul            ;
  432.     ;;      seg:reg, off:nul                                                  ;
  433.     ;;      seg:reg, adr:nul                                                  ;
  434.     ;;      seg:reg, dat:nul                                                  ;
  435.     ;;                                                                        ;
  436.     ;;   SATISFIED BY:                                                        ;
  437.     ;;      MOV    dest_Right, WORD PTR source [0]                            ;
  438.     ;;      MOV    dest_Left,  WORD PTR source [2]                            ;
  439.     ;;------------------------------------------------------------------------;
  440.     i INSTR <SRSO SRSA SRSD SRON SRAN SRDN RRSO RRSA RRSD RRON RRAN RRDN>, dest_source_tokens
  441.     IF (i)
  442.       i INSTR <DS ES>, dest_L
  443.       IF        (i EQ 1)
  444.         LDS    dest_R, source
  445.       ELSEIF    (i EQ 4)
  446.         LES    dest_R, source
  447.       ELSE
  448.         MOV     dest_R, WORD PTR source [0]
  449.         MOV     dest_L, WORD PTR source [2]
  450.       ENDIF
  451.       EXITM
  452.     ENDIF
  453.  
  454.     ;;------------------------------------------------------------------------;
  455.     ;;   display status of parsing process                                    ;
  456.     ;;------------------------------------------------------------------------;
  457.     .ERR MOVE    &dest, &source   is unparsable.
  458.     msg CATSTR <MOVE    &dest, &source   is unparsable.    >, dest_source_tokens
  459.     DISPLAY %msg
  460. ENDM
  461.  
  462. PAGE
  463. ;-----------------------------------------------------------------------------;
  464. ;       Macro Name:   RET_EMM_STATUS   arg                                    ;
  465. ;           Author:   W J Krueger                                             ;
  466. ;             Date:   4/10/89                                                 ;
  467. ;      Description:   The value in AH (the current status of the EMM call)    ;
  468. ;                     is converted to a word & returned to the caller.        ;
  469. ;-----------------------------------------------------------------------------;
  470. RET_EMM_STAT        MACRO    arg
  471.     MOV        AL, arg
  472.     XOR        AH, AH
  473.     RET
  474. ENDM
  475.